using System;
using System.Collections.Generic;
using System.Text;
using System.Data.OleDb;
using DTO;
using System.Data;
using HeThongDAO;

namespace HeThongBUS
{
    public enum TacGiaBUSResult
    {
        OK,
        USERNAMEERROR,
        PASSWORDERROR,
        DAOERROR
    }

    public class TacGiaBUS
    {
        public static DataTable LayTatCaTacGia()
        {
            return HeThongDAO.TacGiaDAO.SelectAll();
        }
        public static DataTable DocSchema()
        {
            return HeThongDAO.TacGiaDAO.DocSchema();
        }

        public static TacGiaBUSResult ThemTacGia(TacGiaDTO tgDTO)
        {
            // Kiem tra du lieu nhap


            if (!TacGiaDAO.ThemTacGia(tgDTO))
                return TacGiaBUSResult.DAOERROR;
            return TacGiaBUSResult.OK;
        }

        public static TacGiaBUSResult CapNhatTacGia(TacGiaDTO tgDTO)
        {
            // Kiem tra du lieu nhap


            if (!TacGiaDAO.CapNhatTacGia(tgDTO))
                return TacGiaBUSResult.DAOERROR;
            return TacGiaBUSResult.OK;
        }

        public static TacGiaBUSResult XoaTacGia(TacGiaDTO tgDTO)
        {
            // Kiem tra du lieu nhap


            if (!TacGiaDAO.XoaTacGia(tgDTO))
                return TacGiaBUSResult.DAOERROR;
            return TacGiaBUSResult.OK;
        }
    }
}
